package org.millioncall.yueyoga.admin.dao.impl;

import java.util.List;
import java.util.Map;

import org.millioncall.openplatform.dao.PreparedQuery;
import org.millioncall.yueyoga.admin.dao.BaseDao;
import org.millioncall.yueyoga.admin.dao.CashDAO;
import org.millioncall.yueyoga.admin.model.Cash;
import org.millioncall.yueyoga.admin.model.CashDetail;
import org.millioncall.yueyoga.admin.model.CashReport;

public class CashDAOImpl extends BaseDao implements CashDAO {

	@Override
	public List<CashReport> findCash(Map<String, Object> map) {
		PreparedQuery<CashReport> pq = this.getPagableSqlSessionTemplate().findAll("findCash", map);
		return pq.list();
	}

	@Override
	public List<Cash> findCashDetail(Map<String, Object> map) {
		PreparedQuery<Cash> pq = this.getPagableSqlSessionTemplate().findAll("findCashDetail", map);
		return pq.list();
	}

	@Override
	public List<CashDetail> findCashDetailByType(Map<String, Object> map) {
		PreparedQuery<CashDetail> pq = null;
		if ("商品".equals(map.get("type")))
			pq = this.getPagableSqlSessionTemplate().findAll("findCashDetailByTypeGoods", map);
		else
			pq = this.getPagableSqlSessionTemplate().findAll("findCashDetailByType", map);
		return pq.list();
	}

	

}
